import { request } from '@umijs/max'

interface ApiResponse<T> {
  code: number
  msg: string
  data: any
  success: boolean
}

/** 取消上传 - 阿里云 */
export async function cancelUploadBigFile(data: any) {
  return request<ApiResponse<any>>('/api/file/aliyun/cancelUploadBigFile', {
    method: 'POST',
    data
  })
}

/** 异常上报接口 - 阿里云 */
export async function reportUploadError(data: any) {
  return request<ApiResponse<any>>('/api/file/aliyun/reportUploadErrorMsg', {
    method: 'POST',
    data
  })
}

/** 获取STS Token - 阿里云 */
export async function getSTSToken(data: any) {
  return request<ApiResponse<any>>('/api/file/aliyun/queryStsInfo', {
    method: 'POST',
    data
  })
}

/** 上传成功后的上报 - 阿里云 */
export async function reportBigFileUrl(data: any) {
  return request<ApiResponse<any>>('/api/file/aliyun/reportBigFileUrl', {
    method: 'POST',
    data
  })
}
